package org.example.simplemanagementsystem.mapper;

import org.apache.ibatis.annotations.*;
import org.example.simplemanagementsystem.pojo.Clazz;
import org.example.simplemanagementsystem.pojo.ClazzQueryParam;
import org.example.simplemanagementsystem.pojo.Emp;

import java.util.List;

@Mapper
public interface ClazzMapper {
    List<Clazz> list(ClazzQueryParam clazzQueryParam);
    @Delete("delete from clazz where id=#{id}")
    void delete(Long id);
    @Insert("insert into clazz(name, room, begin_date, end_date, master_id, subject, create_time, update_time) " +
            "values (#{name}, #{room}, #{beginDate}, #{endDate}, #{masterId}, #{subject}, #{createTime}, #{updateTime})")
    void add(Clazz clazz);
    @Select("select id, name, room, begin_date, end_date, master_id, subject, create_time, update_time from clazz where id = #{id}")
    Clazz getClassById(Long id);
    @Update("update clazz set name = #{name}, room = #{room}, begin_date = #{beginDate}, end_date = #{endDate}, master_id = #{masterId}, subject = #{subject}, update_time = #{updateTime} where id=#{id}")
    void update(Clazz clazz);
    @Select("select id, name, room, begin_date, end_date, master_id, subject, create_time, update_time from clazz")
    List<Clazz> findAll();
}
